<?php

namespace hunma\exception;

use hunma\basic\ApiResponse;
use support\exception\BusinessException;
use Webman\Http\Request;
use Webman\Http\Response;

class ApiException extends BusinessException
{
    public function render(Request $request): ?Response
    {
        return ApiResponse::error($this->getMessage(), $this->getCode()?:400);
    }
}